{% set clazz = "address" %}
{% set title = id|choose('编辑收货人', '新增收货人') %}
{% extends './modules/common/templates/main.html' %}
{% block style %}
  <link rel="stylesheet" type="text/css" href="{{ '/static/css/integral.css'|version }}" />
{% endblock %}
{% block content %}
  {% if !nested %}
    <header class="bar bar-header">
      {{ macro.back() }}
      <h1 class="title">{{ title }}</h1>
    </header>
  {% endif %}
  <form name="address" action="/integral/address" method="post">
    <section class="has-footer">
      {% if error %}
        <div class="message" ui-mode="error">
          <i class="flag"></i>
          <span>{{ error }}</span>
        </div>
      {% endif %}
      <div class="list compact overlap">
        <label class="item item-input">
          <i class="icon text-orange">&#xe609;</i>
          <span class="label">姓名</span>
          <span class="control">
            <input type="text" name="name" placeholder="收货人姓名" value="{{ name }}" maxlength="20" required />
          </span>
        </label>
        <label class="item item-input">
          <i class="icon text-orange">&#xe602;</i>
          <span class="label">性别</span>
          <span class="control">
            <select name="gender" required>
              <option value="1" {% if gender != 0 %}selected{% endif %}>男</option>
              <option value="0" {% if gender == 0 %}selected{% endif %}>女</option>
            </select>
          </span>
        </label>
        <label class="item item-input">
          <i class="icon text-orange">&#xe628;</i>
          <span class="label">手机</span>
          <span class="control">
            <input type="tel" pattern="[0-9]*" name="mobile" placeholder="手机号码" value="{{ mobile }}" maxlength="11" required />
          </span>
        </label>
        <label class="item item-input">
          <i class="icon text-orange">&#xe60d;</i>
          <span class="label">地址</span>
          <span class="control">
            <input type="text" name="address" placeholder="详细地址" value="{{ address }}" maxlength="50" required />
          </span>
        </label>
      </div>
    </section>
    <footer class="bar bar-footer bar-fixed bar-flat">
      <input type="hidden" name="id" value="{{ id }}" />
      <button class="button warning square">保存地址</button>
    </footer>
  </form>
{% endblock %}
{% block script %}
  {% parent %}
  <script src="{{ '/static/js/integral.js'|version }}"></script>
{% endblock %}